<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: Cian
  Date: 2017/6/13
  Time: 20:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    String url = "http://127.0.0.1:8080/pager";
    int maxPageItems = 2;
    request.getSession().setAttribute("maxPageItems",maxPageItems);
%>
<c:forEach items="${pagerUsers}" var="user">
    ${user.username}<br/>
</c:forEach>
<pg:pager items="${totalNum}" export="currentPageNumber=pageNumber" maxPageItems="2">
    <%--<%=111111%>${users.size()}--%>
    <!--访问路径中后置数据.效果如xx.do?method=search-->
    <pg:param name="method" value="search"/>

    <%--<pg:first>--%>
        <%--<a href="<%=url%>">首页</a>--%>
    <%--</pg:first>--%>
    <%--<pg:prev>--%>
        <%--<a href="<%=url%>/<%=currentPageNumber-1%>">前页</a>--%>
        <%--<%=pageUrl%>--%>
    <%--</pg:prev>--%>
    <pg:pages>
        <%--<%=currentPageNumber+"++++++++++++++++"+pageNumber%>--%>
        <c:choose>
            <c:when test="${currentPageNumber eq pageNumber }">
                <a href="${pageUrl}" style="text-decoration: none;color: #000;">${pageNumber }</a>
            </c:when>
            <c:otherwise>
                <a href="/pager/<%=currentPageNumber%>">${pageNumber }</a>
                <%--<a href="http://www.baidu.com">${pageNumber }</a>--%>
            </c:otherwise>
        </c:choose>
    </pg:pages>
    <%--<pg:next>--%>
        <%--<a href="<%=url%>/<%=currentPageNumber-1%>">后页</a>--%>
    <%--</pg:next>--%>
    <%--<pg:last>--%>
        <%--<a href="${pageUrl }">尾页</a>--%>
    <%--</pg:last>--%>
</pg:pager>
</body>
</html>
